import api from '../../axios/axios';
import type {
  SubmitDTO,
  QueryJudgeInfo
} from '../../dto/judge';
import type {
  SubmitResponse,
  JudgeStatusListResponse,
  JudgeResultResponse
} from '../../vo/judge';

// 判题服务相关API
export const judgeApi = {
  // 提交代码
  submitCode: (data: SubmitDTO): Promise<SubmitResponse> => {
    return api.post('/user/problem/submit', data);
  },

  // 获取判题状态列表
  getJudgeStatusList: (data: QueryJudgeInfo): Promise<JudgeStatusListResponse> => {
    return api.post('/user/judge/status/list', data);
  },

  // 获取单个判题结果
  getJudgeResult: (submitId: number): Promise<JudgeResultResponse> => {
    return api.get(`/user/judge/status/${submitId}`);
  }
};

export default judgeApi;